home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / equity.arc / READYPAT.ASM < prev    next >
Encoding:
Assembly Source File  |  1987-02-17  |  2.9 KB  |  115 lines

  1.     page 60,132
  2. ;    Program to let a screen dump take place while Ready! from
  3. ;    Living Videotext is loaded on an Equity I and Equity II.
  4.  
  5. ;    DOS definitions
  6. dos        equ    21h        ;dos interrupt
  7. term_res    equ    31h        ;terminate but stay resident
  8. terminate    equ    4ch        ;terminate process
  9. set_vector    equ    25h        ;set interrupt vector
  10. get_vector    equ    35h        ;get interrupt vector
  11. display_str    equ    09        ;display string
  12. ;    Interrupt numbers
  13. video_int    equ    10h
  14. ;    Control characters
  15. cr        equ    0dh
  16. lf        equ    0ah
  17.  
  18. code        segment para 'CODE'
  19.  
  20.     assume    cs:code,ds:nothing,es:nothing,ss:nothing
  21.     org    100h
  22.  
  23. begin:    jmp    short start
  24.  
  25. ready    proc    far
  26.  
  27. new_video_int:        ;BIOS video (INT 10H) is redirected here.
  28.  
  29.     pushf            ;set up for IRET from vid int
  30.     push    cs        ;same
  31.     mov    word ptr cs:ax_save,ax    ;save temporarily
  32.     mov    ax,offset continue    ;get continuation address 
  33.     push    ax            ;save it for IRET from video
  34.     mov    ax,word ptr cs:ax_save    ;restore user's AX
  35. go_vid:    jmp    dword ptr cs:old_video_int_off    ;go to real int 10h
  36.     
  37. continue:
  38.     iret            ;back to user
  39.  
  40. sig_offset    equ    $ - new_video_int
  41. res_sig:    db    'Readypat'
  42. sig_len        equ    $ - res_sig
  43.  
  44. ax_save:    dw    ?
  45. return_off:    dw    ?
  46. return_seg:    dw    ?
  47.  
  48. old_video_int_off:    dw    ?
  49. old_video_int_seg:    dw    ?
  50. last        equ    $-1    ;mark end of resident code
  51. ready    endp
  52.  
  53.     assume ds:code
  54. start    proc near    ;redirect video int to point to
  55.             ;new_video_int and save current vector
  56.  
  57.     mov    sp,offset stack
  58.     call    chk_res        ;see if we're resident already
  59.                 ;returns interrupt address in ES:BX
  60.  
  61.     mov    word ptr old_video_int_off,bx        ;store offset
  62.     mov    word ptr old_video_int_seg,es        ;store segment
  63.  
  64.     mov    dx,offset new_video_int        ;DS:DX is now new int address
  65.     mov    al,video_int    ;video interrupt #
  66.     mov    ah,set_vector    ;set vector func
  67.     int    dos        ;set int 10h to new_video_int
  68.  
  69.     mov    dx,offset last    ;byte count of code to stay resident
  70.     mov    cl,4
  71.     shr    dx,cl        ;change to paragraph count
  72.     inc    dx        ;just to be sure
  73.     mov    ah,term_res
  74.     mov    al,0        ;return code of 0
  75.     int    dos        ;that's all folks
  76. start    endp
  77.  
  78. chk_res        proc near    ;check if ready routine resident
  79.                 ;if not, returns current video interrupt
  80.                 ;in ES:BX
  81.     mov    ah,get_vector
  82.     mov    al,video_int    ;video interrupt
  83.     int    dos        ;get video interrupt vector in es:bx
  84.     mov    di,sig_offset    ;offset of signature bytes from int offset
  85.     add    di,bx        ;add in interrupt offset
  86.     mov    si,offset res_sig    ;point to sig bytes
  87.     mov    cx,sig_len    ;length of sig
  88.     cld
  89.     repz    cmpsb        ;is it there?
  90.     jz    its_there
  91.     ret            ;back to main program
  92.  
  93. its_there:    ;print already resident message
  94.     pop    ax
  95.     pop    ax
  96.     pop    ax        ;clean up stack
  97.  
  98.     mov    dx,offset there_mes
  99.     mov    ah,display_str
  100.     int    dos        ;display message
  101.     mov    ah,terminate    ;normal end of process
  102.     mov    al,0
  103.     int    dos        ;back to calling process
  104.  
  105. there_mes:
  106.     db    cr,lf,'Already resident ...',cr,lf,'$'
  107. chk_res        endp
  108.  
  109. stk:        db    16 dup('STACK...')
  110. stack        label    word
  111. code        ends
  112.         end    begin
  113. lf,'Already resident ...',cr,lf,'$'
  114. chk_res        endp
  115.